package com.yonyou.pmclouds.problemlog.mapper;

import com.yonyou.pmclouds.basecom.dao.BaseMapper;
import com.yonyou.pmclouds.problemlog.entity.ProblemLogVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

//@CacheNamespace(implementation = RedisCache.class)
public interface ProblemLogMapper extends BaseMapper<ProblemLogVO>{

    @Select("select * from pm_problemlog where   pk_project = #{pk_project} and dr = 0  order by (case billstatus when 0 then 1 else billstatus end) , creationtime desc")
    @ResultMap("getMap")
    ProblemLogVO[] selectByPkProject(String pk_project);  
    
    int selectCountByProject(String pk_project);

    Integer selectRefByCode(@Param("code")String code,@Param("ids") String[] ids);

    ProblemLogVO[] queryProblemLog(@Param("pkProject")String pkProject, @Param("billStatus")int billStatus);

    @Select("select * from pm_problemlog where pk_project in (${pkProjects}) and dr = 0 order by creationtime desc")
    @ResultMap("getMap")
    ProblemLogVO[] getByPkProjects(@Param("pkProjects") String pkProjects);

    ProblemLogVO[] queryByCondition(@Param("pkProjects")String[] pkProjects,
                                          @Param("creators") String[] creators,
                                          @Param("startDate") String startDate,
                                          @Param("endDate") String endDate,
                                          @Param("billStatus") int[] billStatus,
                                          @Param("start") int start,
                                          @Param("size") int size);
    int countByCondition(@Param("pkProjects")String[] pkProjects,
                         @Param("creators") String[] creators,
                         @Param("startDate") String startDate,
                         @Param("endDate") String endDate,
                         @Param("billStatus") int[] billStatus);

    ProblemLogVO[] queryAllProjectParts();

    void updatePkProjectParts(@Param("pkProject") String pkProject, @Param("partName") String partName, @Param("pkProjectpart") String pkProjectpart);

}
